<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class AuthRelation extends Model
{
    protected $table = 'auth_relations';

    public static function insertAll($uid,$array){
        AuthRelation::where("uid",$uid)->delete();
        $relation = [];
        foreach ($array as $val) {
            $relation[] = [
                "uid"       => $uid,
                "group_id"  => $val
            ];
        }
        AuthRelation::insert($relation);
        return true;
    }
}
